import request from '@/utils/request'

// 查询selectCourse列表
export function listSelectCourse(query) {
  return request({
    url: '/course/selectCourse/list',
    method: 'get',
    params: query
  })
}

// 查询selectCourse详细
export function getSelectCourse(courseId) {
  return request({
    url: '/course/selectCourse/' + courseId,
    method: 'get'
  })
}

// 新增selectCourse
export function addSelectCourse(data) {
  return request({
    url: '/course/selectCourse',
    method: 'post',
    data: data
  })
}

// 修改selectCourse
export function updateSelectCourse(data) {
  return request({
    url: '/course/selectCourse',
    method: 'put',
    data: data
  })
}

// 删除selectCourse
export function delSelectCourse(courseId) {
  return request({
    url: '/course/selectCourse/' + courseId,
    method: 'delete'
  })
}

// 查询选课状态
export function getCourseSelectionStatus(courseId) {
  return request({
    url: '/course/selectCourse/courseSelection/' + courseId,
    method: 'get'
  })
}

// 选择课程
export function confirmSelection(courseId) {
  return request({
    url: '/course/selectCourse/courseSelection',
    method: 'post',
    params: { courseId } // 使用 params 发送表单参数
  })
}

// 取消选课
export function cancelSelection(courseId) {
  return request({
    url: '/course/selectCourse/courseSelection/' + courseId,
    method: 'delete'
  })
}
